<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page pageEncoding="UTF-8" %>
<%@ include file="../common/common.jsp"%>
<%@ page import="jp.co.technotree.apl.api.common.Message" %>
<%@ page import="jp.co.technotree.apl.cmd.master.Mst1000Bean;" %>
<jsp:useBean id="formBean" class="jp.co.technotree.apl.cmd.master.Mst1000Bean" scope="request" />
<%
    
    Mst1000Bean.Record[] recordList = formBean.getRecordList();

%>
<html>
	<head>
		<title>予備品管理システム - 品番単価表取込画面</title>
		<link rel="SHORTCUT ICON" href="../common/img/default/sys_icon.ico">

		<link rel='stylesheet' type='text/css' href='../../common/css/common/base.css' >
		<link rel='stylesheet' type='text/css' href='../../common/css/common/common.css'>
		<link rel='stylesheet' type='text/css' href='../../common/css/master/mst1000.css'>

		<script language="javascript" src="../../common/js/base.js"></script>
		<script language="javascript" src="../../common/js/menu/topmenu.js"></script>

		<!--ポップアップ用-->
		<link rel='stylesheet' type='text/css' href='../../common/css/popUpPc.css' >
		<script type='text/javascript' src='../../common/js/popUpPc.js'></script>
		
		<!-- システムログ -->
		<script src="../../common/js/systemlog.js"></script>

			<style type='text/css'>
.LinkItem {
	cursor: pointer;
}
.div-wid {
	border-bottom:solid 1px #ccc;
	width:580px; /* 横幅合計 + スクロールバー分 */
	height:400px;
	overflow:auto;
}
			</style>

<script language="javascript">
function onInit(){
	//topBackChange(0);
	//httpRequest();
	<%if("1".equals(formBean.getErrMsgFlg())){%>
		alert_Custom("<%=Message.getMessage("INF00010")%>");
	<%}%>
	<%
		String result = formBean.getResult();
		String resultMsg = "";
		String resultErrMsg = "";
		if (result != null && !result.equals("null") && !"".equals(result)){
			if (result.equals("200")){
				resultMsg = Message.getMessage("INF00020").replace("$1","単価取込み処理");
			}else if(result.equals("400")){
				resultErrMsg = Message.getMessage("WRN01600");
			}else if(result.equals("405")){
				resultErrMsg = Message.getMessage("WRN01610");
			}else if(result.equals("501")){
				resultErrMsg = Message.getMessage("WRN01620");
			}else{
				resultErrMsg = Message.getMessage("WRN01630");
			}
		}
	%>
	var afterFunc="nextPageJump('topmenu1000');"
	<%if(!"".equals(resultMsg)){%>
		alert_Info2("<%=resultMsg%>",afterFunc);
	<%}%>
	<%if(!"".equals(resultErrMsg)){%>
		alert_Custom2("<%=resultErrMsg%>",afterFunc);
	<%}%>
}

//戻るボタン押下
function backBtn(nextPage){
	nextPageJump(nextPage);
}

function nextPageJump(nextPage){
	mainForm = document.getElementById("F1");
	document.getElementById("nextPage").value = nextPage;
	mainForm.submit();
}

function importBtn(){
	
	var uploadFile = document.getElementById("uploadFile").value;
	
	if(uploadFile ==""){
		alert_Custom("<%=Message.getMessage("WRN00010").replace("$1", "取込ファイル名")%>");
		return ;
	}
	
	var afterFunc="yesImportBtn();"
	if (!confirm_Custom3("<%=Message.getMessage("INF01130")%>",afterFunc)){
		return ;
	}
}

//「はい」を押された時
function yesImportBtn(){
	alert_import("<%=Message.getMessage("INF01300")%>");
	document.getElementById("importExe").value = "1";
	mainForm = document.getElementById("F1");
	mainForm.submit();
}

//-------------------------------------------------------------------------
//<!-- ポップアップ START -->

//パップアップ解除
function back(){
	document.getElementById("opAlertBtn").style.display = "none";
	document.getElementById("opAlert").style.display = "none";
	document.getElementById("opAlertButton").style.display = "none";
	document.getElementById("opAlertTop").style.display = "none";
	document.getElementById("allbackgr").style.display = "none";
}

//<!-- ポップアップ END -->
//-------------------------------------------------------------------------
</script>

	</head>

	<body onLoad="onInit()" style="margin: 0px 4px 0px 0px;">
		<form class="frmMain" name="main" id="F1" action="./mst1000" method="post" enctype="multipart/form-data" onsubmit="return false;">
			<table class="tblMain" width="100%" cellspacing="0" cellpadding="0" border="0">
				<tr>
					<td>
						<table class='main-width-tb'  cellspacing='0' cellpadding='0' border='0'><tr><td></td></tr></table>
						<table class='main-height-tb' cellspacing='0' cellpadding='0' border='0'><tr><td></td></tr></table>

						<!-- Header Menu START -->
						<div class="header-title">予備品管理システム(<%=formBean.kojou%>)</div>
						<!-- Header Menu END -->

						<!-- ***** [FORM] MAIN-FORM ***** -->
						<div id="lc-out" style="z-index: 0;">
							<div id="lc-in" style="z-index: 0">

								<div class="TxtCenter" style="width: 98%;">
									<div class="subtitle">品番単価表取込画面</div>
									<table  border="0" style="width: 50%;">
										<tr>
											<td>
												<table border="0" width="50%">
													<tr>
														<td>
															取込ファイル名
														</td>
													</tr>
													<!-- スペース -->
													<tr height="10px"><td></td></tr>
													<tr>
														<td class="TxtLeft" colspan="2">
															<input type="file" style="width:500px;" name="uploadFile" id="uploadFile"/>
														</td>
													</tr>
													<!-- スペース -->
													<tr height="5px"><td></td></tr>
													<tr>
														<td class="TxtRight" colspan="2">
															<input type="image" src="../../common/img/pc/btn_upload_off.png" onclick="importBtn()" alt="取込開始">
															&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
															<input type="image" src="../../common/img/pc/btn_back_off.png" onclick="backBtn('topmenu1000');">
														</td>
													</tr>
													<!-- スペース -->
												<tr style="height: 10px;"><td></td></tr>
												</table>
											</td>
										</tr>
									</table>
								</div>
							</div><!-- lc-in End -->
							<div id="lc-in_under" style="z-index: 0">
								<!-- スペース -->
								<table height="10px"><tr><td></td></tr></table>

								<table  border="0" style="width: 98%;" class="TxtCenter">
									<tr>
										<td>
											<div style="width:560px;text-align:left;">
												<!-- header column  -->
												<table  border="1" width="560px" height="30px" class="data-grid" >
													<thead>
														<tr>
															<th class="TblField1" style="background-color: #CAE1FF;">&nbsp;</th>
															<th class="TblField2" style="background-color: #CAE1FF;">処理日</th>
															<th class="TblField3" style="background-color: #CAE1FF;">担当</th>
															<th class="TblField4" style="background-color: #CAE1FF;">処理件数</th>
															<th class="TblField5" style="background-color: #CAE1FF;">エラー</th>
														</tr>
													</thead>
												</table><!-- header column  -->
												<!-- data column -->
												
												<div class="div-wid" id="div-wid"class="TxtCenter" >
												<table  border="1" width="560px" height="30px" class="data-grid" >
<%if("1".equals(formBean.getSubmitFlag())){%>
<%
		if ( recordList!=null) {
			if ( recordList.length == 0 ){
%>			
			<tr height="120px">
				<td colspan="5">データが存在しません。</td>
			</tr>
<%			
			}
			for (int i=0; i<recordList.length; i++) {
				Mst1000Bean.Record record=recordList[i];
				//担当者のスプリット
				String usrNm = record.usrNm;
				String[] strUsrNm = usrNm.split("\\s+");;
				if(strUsrNm.length > 1){
					usrNm = strUsrNm[0];
				}
%>
													<tr style="background-color: <%=("true".equals(record.colorFlg))?"#FFFFFF":"" %>">
														<td class="TxtCenter TblField1">
															<%=i+1%>
														</td>
														<td class="TblField2"><%=record.createDt%></td>
														<td class="TblField3"><%=record.createUsr%></td>
														<td class="TxtRight TblField4" ><%=record.getCnt%></td>
														<td class="TxtRight TblField5" ><%=record.getErrCnt%></td>
													</tr>
<% 	
			}
		}
}
%>
												</table><!-- data column -->
												</div>
											</div>
										</td>
									</tr>
								</table><!-- list  -->
							</div>

						</div><!-- lc-out  -->
					</td>
				</tr>
			</table>

			<input type="hidden" name="cmd" value="cmd01">
			<input type="hidden" id="nextPage" name="nextPage" value="">
			<input type="hidden" id="importExe" name="importExe" value="">
			
			<!--警告 ポップアップ---------------------------------------------------------------------------- -->
			<div id="allbackgr" class="allbackgr" style="display:none;"></div>
			<div class="opAlertBtn" id = "opAlertBtn" style="display:none;" ></div>
			<div class="opAlertButton" id = "opAlertButton" style="display:none;" ></div>
			<div class="opAlertTop" id = "opAlertTop" style="display:none; font-size:22px;">　予備品管理システム　</div>
			<div class="opAlert" id = "opAlert" style="display:none;"></div>
			<!-- -------------------------------------------------------------------------------------------- -->
		</form>
	</body>
</html>
